package com.xm.xmapp;

import android.os.Bundle;
import android.webkit.WebView;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.android.volley.VolleyError;
import com.xm.xmapp.app.MyAppcation;
import com.xm.xmapp.base.BaseActivity;
import com.xm.xmapp.myinterface.DisssmissInterFace;
import com.xm.xmapp.myinterface.GetDataInterFace;
import com.xm.xmapp.request.bean.Get_user_message_by_idRequest;
import com.xm.xmapp.response.bean.ResponseUserMessageById;

public class MyAssetDetailsActivity extends BaseActivity{

	private TextView message_time,message_title;
	private WebView message_content;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_messagedetails);
	}
	
	@Override
	public void initView() {
		message_time = (TextView) findViewById(R.id.message_time);
		message_content = (WebView) findViewById(R.id.message_content);
		message_title = (TextView) findViewById(R.id.message_title);
	}

	@Override
	public void initData() {
	
		setMyTitle("我的消息");
		String id = getIntent().getStringExtra("id");
		getData(id+"");	
	}

	private void getData(String user_message_id) {
	
		Get_user_message_by_idRequest requestBean = new Get_user_message_by_idRequest();
		requestBean.user_message_id = user_message_id;
		promptDialog.show();
		MyAppcation.getMyAppcation().getPostData(this, requestBean, new GetDataInterFace<String>() {
			
			@Override
			public void onResponse(String response) {
				promptDialog.dismiss();
				ResponseUserMessageById bean = JSON.parseObject(response, ResponseUserMessageById.class);
				if(bean!=null) {
					message_time.setText(bean.modified_on);				
					message_content.loadDataWithBaseURL(null,bean.user_message_content, "text/html", "utf-8",null);
					message_title.setText(bean.user_message_title);
				}
				
			}
		}, new DisssmissInterFace() {
			
			@Override
			public void putError(VolleyError error) {
				promptDialog.dismiss();
			}
		});
	}

	@Override
	public void initEvent() {

	}


}
